<template>
  <div class="app-container">
    <el-form :model="form">
      <el-card class="box-card">
        <div slot="header" class="clearfix">
          <span>模式选择</span>
        </div>
        <div class="text item">
          <el-form-item label="严格模式" label-width="80px">
            <el-switch
              v-model="form.strict_mode"
            >
            </el-switch>
          </el-form-item>
        </div>
        <div class="text item">
          <el-form-item label="登船方向" label-width="80px">
            <el-radio-group v-model="form.direction">
              <el-radio :label="0">从左往右为登船</el-radio>
              <el-radio :label="1">从右往左为登船</el-radio>
            </el-radio-group>
          </el-form-item>
        </div>
        <el-form-item>
          <el-button type="primary" @click="SetAlgWrapperParam">保存</el-button>
        </el-form-item>
      </el-card>
    </el-form>

  </div>

</template>

<script>
    export default {
        name: "boardingDirection",
        data() {
          return {
            form: {
              direction:0,
              strict_mode:0
            }
          }
        },
        methods: {
          getAlgWrapperParam:function(){
            var _this=this
            _this.postAjax({
              method:'getAlgWrapperParam',
              params:{}
            }).then(function (res) {
              console.log(res);
              if(res.result==0){
                var data=res.params
                // debugger
                _this.form.direction=data.boarding_dir
                _this.form.strict_mode=data.strict_mode==1?true:false
              }else{
                _this.tips(res.errorInfo.detail,'error')
              }
            }).catch(function (err) {
              console.log(err);
              _this.tips(res.errorInfo.detail,'error')
            }).finally(function (fn) {
              console.log(fn);
            })
          },
          SetAlgWrapperParam:function () {
            var _this=this
            _this.loading=true
            _this.postAjax({
              method:'SetAlgWrapperParam',
              params:{
                boarding_dir:_this.form.direction,
                strict_mode:_this.form.strict_mode?1:0
              }
            }).then(function (res) {
              console.log(res);
              if(res.result==0){
                _this.tips('保存成功','success')
                // var data=res.params
                // // debugger
                // _this.form.ip=data.ip
                // _this.form.gateway=data.gateway
                // _this.form.mask=data.mask
                // _this.form.dns1=data.dns1
                // _this.form.dns2=data.dns2
              }else {
                _this.tips(res.errorInfo.detail,'error')
              }
            }).catch(function (err) {
              console.log(err);
            }).finally(function (fn) {
              _this.loading=false
              console.log(fn);
            })
          }
        },mounted:function () {
        this.getAlgWrapperParam()
      }
    }
</script>

<style scoped>

</style>
